package com.bwie.controller;
import com.bwie.pojo.Order;
import com.bwie.pojo.ProdInfo;
import com.bwie.service.OrderService;
import com.bwie.service.impl.OrderServiceImpl;
import com.bwie.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
* 订单表(t_order)表控制层
*
* @author xxxxx
*/
@RestController
@RequestMapping("/shop/index/")
@Api(tags = "订单模块")
public class OrderController {
/**
* 服务对象
*/
    @Autowired
    private OrderService orderService;

    @ApiOperation("分页列表查询")
    @PostMapping("SelectOrderList")
    public R SelectOrderList(@RequestBody Order order){
       return orderService.orderService(order);
    }

    @ApiOperation("获取上线的商品集合")
    @GetMapping("selectUpGoods")
    public R selectUpGoods(){
        return orderService.selectUpGoods();
    }

    @ApiOperation("保存订单信息")
    @PostMapping("saveOrderOk")
    public R saveOrderOk(@RequestBody List<ProdInfo> infoList){
        return orderService.saveOrderOk(infoList);
    }
    @ApiOperation("订单导出")
    @GetMapping("exportOrder")
    public void exportOrder(){
         orderService.exportOrder();
    }
    @ApiOperation("订单删除批量操作")
    @PostMapping("delBatchOrder")
    public R delBatchOrder(@RequestBody List<Integer> orderIds){
       return orderService.delBatchOrder(orderIds);
    }
}
